package Arraylist;
/*
题目：
定义一个数组，用来存储3个person对象

数组的缺点：一旦定义长度不能更改
*/
public class Demo01ArrayObject {
    public static void main(String[] args) {
        //首先创建一个长度为3的数组，里面用来存放person类型的对象
        Person[] array = new Person[3];

        Person one = new Person(28,"迪丽热巴");
        Person two = new Person(29,"古力娜扎");
        Person three = new Person(30,"赵丽颖");

        //将one中的地址值赋值到数组的0号元素位置
        array[0] = one;
        array[1] = two;
        array[2] = three;

        System.out.println(one.getAge()+one.getName());
        System.out.println(array[0].getAge()+array[1].getName());
    }
}
